﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using _1._6._2015_MovieTheater.Data;
using _1._6._2015_MovieTheater.Models;

namespace _1._6._2015_MovieTheater.Controllers
{
    public class MovieController : Controller
    {
        public ActionResult Index()
        {
            MovieTheaterDbContext db = new MovieTheaterDbContext();
            MoviesViewModel model = new MoviesViewModel();

            model.Movies = db.Movies.Select(m => new MovieViewModel
                {
                    Description = m.Description,
                    PosterUrl = m.PosterUrl,
                    Rating = m.Rating,
                    Title = m.Title
                }).ToList();


            return View(model);
        }
        public ActionResult Detail(MovieViewModel model)
        {
      
            return View(model);
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}